package com.obas.test;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

import com.ease.common.util.FileUtil;
import com.ease.common.vo.ClasspathEntry;
import com.ease.common.vo.ProjectClasspath;
import com.ease.oxm.jaxb.JaxbUtil;

public class ExportClasspathJar {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		String string = FileUtil.readClassPathResourceToString(ExportClasspathJar.class, ".classpath");
		ProjectClasspath projectClasspath = JaxbUtil.xmlToObject(string, ProjectClasspath.class);
		if (null == projectClasspath) {
			return;
		}

		for (ClasspathEntry classpathEntry : projectClasspath.getClasspathEntries()) {

			String path = classpathEntry.getPath();
			if (null != path && path.endsWith("jar")) {
				path = "D:/repository/workspaces/library_default" + path;
				String name = path.substring(path.lastIndexOf("/") + 1);
				FileUtils.copyFile(new File(path), new File("D:/lib/" + name));
			}

		}
	}

}
